package com.nbst.dao.datasource;

//@Configuration
//@MapperScan(basePackages = "com.nbst.dao.mapper.mes", sqlSessionTemplateRef  = "mesSqlSessionTemplate")
public class MesDataSourceConfiguration {
	/*
	 * 
	 * @Value("${spring.datasource.mes.driverClassName}") private String
	 * driverClassName;
	 * 
	 * @Value("${spring.datasource.mes.url}") private String url;
	 * 
	 * @Value("${spring.datasource.mes.username}") private String username;
	 * 
	 * @Value("${spring.datasource.mes.password}") private String password;
	 * 
	 * @Value("${spring.datasource.initialSize}") private int initialSize;
	 * 
	 * @Value("${spring.datasource.minIdle}") private int minIdle;
	 * 
	 * @Value("${spring.datasource.maxActive}") private int maxActive;
	 * 
	 * @Value("${spring.datasource.maxWait}") private int maxWait;
	 * 
	 * @Value("${spring.datasource.timeBetweenEvictionRunsMillis}") private int
	 * timeBetweenEvictionRunsMillis;
	 * 
	 * @Value("${spring.datasource.minEvictableIdleTimeMillis}") private int
	 * minEvictableIdleTimeMillis;
	 * 
	 * @Value("${spring.datasource.validationQuery}") private String
	 * validationQuery;
	 * 
	 * @Value("${spring.datasource.testWhileIdle}") private boolean testWhileIdle;
	 * 
	 * @Value("${spring.datasource.testOnBorrow}") private boolean testOnBorrow;
	 * 
	 * @Value("${spring.datasource.testOnReturn}") private boolean testOnReturn;
	 * 
	 * @Value("{spring.datasource.connectionProperties}") private String
	 * connectionProperties;
	 * 
	 * @Bean(name = "mesDataSource")
	 * 
	 * @Primary public DataSource dataSource() { DruidDataSource dataSource = new
	 * DruidDataSource(); dataSource.setDriverClassName(this.driverClassName);
	 * dataSource.setUrl(this.url); dataSource.setUsername(this.username);
	 * dataSource.setPassword(this.password);
	 * 
	 * //具体配置 dataSource.setInitialSize(initialSize);
	 * dataSource.setMinIdle(minIdle); dataSource.setMaxActive(maxActive);
	 * dataSource.setMaxWait(maxWait);
	 * dataSource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
	 * dataSource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
	 * if(driverClassName.contains("microsoft.sqlserver")) {
	 * dataSource.setValidationQuery("SELECT 1"); }else {
	 * dataSource.setValidationQuery(validationQuery); }
	 * dataSource.setTestWhileIdle(testWhileIdle);
	 * dataSource.setTestOnBorrow(testOnBorrow);
	 * dataSource.setTestOnReturn(testOnReturn);
	 * dataSource.setConnectionProperties(connectionProperties); return dataSource;
	 * }
	 * 
	 * @Bean(name = "mesSqlSessionFactory")
	 * 
	 * @Primary public SqlSessionFactory
	 * sqlSessionFactory(@Qualifier("mesDataSource") DataSource dataSource) throws
	 * Exception { SqlSessionFactoryBean bean = new SqlSessionFactoryBean();
	 * bean.setDataSource(dataSource); //分页插件 Interceptor interceptor = new
	 * PageInterceptor(); Properties properties = new Properties(); //数据库
	 * properties.setProperty("helperDialect", "mysql"); //是否将参数offset作为PageNum使用
	 * properties.setProperty("offsetAsPageNum", "true"); //是否进行count查询
	 * properties.setProperty("rowBoundsWithCount", "true"); //是否分页合理化
	 * properties.setProperty("reasonable", "false");
	 * interceptor.setProperties(properties); bean.setPlugins(new Interceptor[]
	 * {interceptor}); bean.setMapperLocations(new
	 * PathMatchingResourcePatternResolver().getResources(
	 * "classpath:mybatis/mes/*.xml")); return bean.getObject(); }
	 * 
	 * @Bean(name = "mesTransactionManager")
	 * 
	 * @Primary public DataSourceTransactionManager
	 * transactionManager(@Qualifier("mesDataSource") DataSource dataSource) {
	 * return new DataSourceTransactionManager(dataSource); }
	 * 
	 * @Bean(name = "mesSqlSessionTemplate")
	 * 
	 * @Primary public SqlSessionTemplate
	 * sqlSessionTemplate(@Qualifier("mesSqlSessionFactory") SqlSessionFactory
	 * sqlSessionFactory) throws Exception { return new
	 * SqlSessionTemplate(sqlSessionFactory); }
	 */}
